﻿var Request = new Req();

$(function () {


	function showProgress() {
		console.log("show");
	    $('#laoding').show();
	}
	function hideProgress() {
	    $('#loading').hide();
	}

	$.ajaxSetup({
		url: "index.php",
		dataType: "json",
		type: "post",
		async: true,
		beforeSend: function(){
			console.log('show')
			showProgress()
		},
		complete: function(){
			hideProgress();
		}
		,
		error: function(result, status, error){
			console.log("---AJAX RECEIVE ERROR---");
			console.log(status);
			console.log(error);
			console.log(result);
		}
		
	});

});

function Req(){

	var me = this;

	this.Make = function(obj, act, val){
		return '<req obj="'+ obj +'" act="'+ act +'" val="'+ val +'" />';
	}

	this.Post = function(postData, cbFunc){
		$.ajax({
			data: postData
		}).done(function(xmlData){
			if(cbFync){
				cbFunc(xmlData);
			}
		});
	}

}
